﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MeterialManager.Utility
{
    public class ResponseObject<T>
    {
        public string msg { get; set; }
        public int code { get; set; }
        public T data { get; set; }

        public ResponseObject(string msg = "", int code = 0, T data = default(T))
        {
            this.msg = msg;
            this.code = code;
            this.data = data;
        }

        public static ResponseObject<T> CreateSuccessResponse(T data)
        {
            return new ResponseObject<T>("操作成功", 200, data);
        }

        public static ResponseObject<T> CreateFailureResponse(string msg, int code)
        {
            return new ResponseObject<T>(msg, code);
        }
    }



}
